package com.scs.application.modules.msg.enums;

import lombok.Getter;

/**
 * @description: 收件人类型
 */
public enum ReceiverType {
    ALL("all", "全部"), USER("user", "用户"),
    DEPT("dept", "部门"), ROLE("role", "角色");

    @Getter
    private String code;

    @Getter
    private String desc;

    ReceiverType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ReceiverType of(String code){
        switch (code){
            case "all":
                return ReceiverType.ALL;
            case "user":
                return ReceiverType.USER;
            case "dept":
                return ReceiverType.DEPT;
            case "role":
                return ReceiverType.ROLE;
        }
        return ReceiverType.USER;
    }
}
